<?php
	class PublicAction extends Action {
		/**
		 *本函数用于公共模板对中数据库的调用
		 *
		*/
		public function index(){
	    	$m=M('Menu');
			$menu=$m->order('id')->select();
			$this->assign('menu',$menu);
	    	/*footer单页*/
			$m=M('Singlepage');
			$singlepage=$m->order('id')->select();
			$this->assign('singlepage',$singlepage);
			/*footer友情链接*/
			$m=M('Links');
			$where['status']=1;
			$links=$m->order('id')->where($where)->select();
			$this->assign('links',$links);
			/*右边栏文章标签*/
			$m=M('Content');
			$article=$m->order('hits desc,id asc')->limit(10)->select();
			$this->assign('hots_article',$article);
			$news=$m->order('id desc')->limit(4)->select();
			$this->assign('news_article',$news);
			/*标签*/
			$tag='';
			foreach ($article as $key => $val){
				$tag.=$val['keywords'].',';
			}
			$tag=explode(',',rtrim($tag,','));
			shuffle($tag);
			$tag=array_slice($tag,0,18);
			$this->assign('tag',$tag);
			
			
			
		}
	}

?>